import request from '../utils/request';
import { LoginRequest, LoginResponse } from '../types/login';

/**
 * User login API
 * @param phone User's phone number
 * @param password User's password
 * @returns Login response with token and user information
 */
export const login = async (phone: string, password: string): Promise<LoginResponse> => {
  const loginData: LoginRequest = {
    phone,
    password,
    clientId: '195da9fcce574852b850068771cde034', // Hardcoded as fallback
    grantType: 'webphone',
    userType: 'web'
  };

  return request.post('/api/admin/auth/webLogin', loginData);
};